//
//  AppDelegate.m
//  CivilianTravel
//
//  Created by xalo on 16/7/12.
//  Copyright © 2016年 许仕杰. All rights reserved.
//

#import "AppDelegate.h"
#import "CustomViewController.h"
#import "UMSocial.h"
#import "UMSocialQQHandler.h"
#import "UMSocialWechatHandler.h"
#import "UMSocialSinaSSOHandler.h"
@interface AppDelegate ()

@end

@implementation AppDelegate



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    //友盟第三方登录
    //设置友盟社会化组件appkey
    [UMSocialData setAppKey:@"5791eb7e67e58eede3000ecd"];
    
    //设置微信AppId、appSecret，分享url
    [UMSocialWechatHandler setWXAppId:@"wxacb9f2161e26ed87" appSecret:@"6f5f79d08a3a161167756f7eb744145a" url:@"http://www.lanou3g.com"];
    
    //设置手机QQ 的AppId，Appkey，和分享URL，需要#import "UMSocialQQHandler.h"
    [UMSocialQQHandler setQQWithAppId:@"1105574328" appKey:@"o2SH3LMsyxp7rKaL" url:@"http://www.lanou3g.com"];
    
    //打开新浪微博的SSO开关，设置新浪微博回调地址，这里必须要和你在新浪微博后台设置的回调地址一致。需要 #import "UMSocialSinaSSOHandler.h"
    [UMSocialSinaSSOHandler openNewSinaSSOWithAppKey:@"990868415" secret:@"d99f1549770490ad7aa01c53ae962a28" RedirectURL:@"http://sns.whalecloud.com/sina2/callback"];
    
    
    //高德地图第三方appKey
    [AMapServices sharedServices].apiKey =@"b5af4b30fafbd2a096963aebf33d6dce";
    //设置窗口
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    // 设置tabBarColor
    [[UITabBar appearance]setBackgroundImage:[UIImage imageNamed:@"tabbar.jpg"]];
    self.window.rootViewController = [[CustomViewController alloc]init];
    EMOptions *options = [EMOptions optionsWithAppkey:@"li745154653#tdxmly"];
    [[EMClient sharedClient] initializeSDKWithOptions:options];
    return YES;
}

//配置系统回调
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    BOOL result = [UMSocialSnsService handleOpenURL:url];
    if (result == FALSE) {
        //调用其他SDK，例如支付宝SDK等
    }
    return result;
}

- (void)applicationWillResignActive:(UIApplication *)application {
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
     [[EMClient sharedClient] applicationDidEnterBackground:application];
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
     [[EMClient sharedClient] applicationWillEnterForeground:application];
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
}


- (void)applicationWillTerminate:(UIApplication *)application {
}

@end
